<script>
  import useToast from '@/utils/toast.js';
  export default {
    onLaunch: function () {
      console.log('App onLaunch');
      // uni.login({
      //   provider: 'weixin',
      //   success: (res) => {
      //     console.log(res, 'code')
      //   }
      // })
      const userInfo = {
        nickname: '着迷',
        phone: '17358486814',
        encryptedPhone: '173****6814',
        avatar: 'https://thirdqq.qlogo.cn/g?b=sdk&k=oQJibma50FXHgWCIn3R2edA&kti=ZMougwAAAAA&s=140&t=1690964846'
      }
      const systemInfo = uni.getSystemInfoSync(); //获取系统信息
      const menuInfo = uni.getMenuButtonBoundingClientRect(); // 获取胶囊按钮的信息
      this.globalData.userInfo = userInfo;
      this.globalData.toast = useToast();
      this.globalData.statusBarHeight = systemInfo.statusBarHeight; // 获取状态栏的高
      this.globalData.windowHeight = systemInfo.windowHeight;
      this.globalData.menuWidth = menuInfo.width; // 获取胶囊按钮的宽度
      this.globalData.menuHeight = menuInfo.height; // 获取胶囊按钮的高度
      this.globalData.menuLeft = menuInfo.left; // 获取胶囊按钮的距离屏幕最右边的距离（此处用于设置导航栏左侧距离屏幕的距离
      this.globalData.menuRight = menuInfo.right; // 获取胶囊按钮的距离屏幕最右边的距离（此处用于设置导航栏左侧距离屏幕的距离
      this.globalData.menuBottom = menuInfo.bottom; // 获取胶囊按钮的距离屏幕最右边的距离（此处用于设置导航栏左侧距离屏幕的距离
      this.globalData.navBarHeight = (menuInfo.top - systemInfo.statusBarHeight) * 2 + menuInfo.height; // 计算出导航栏的高度
      this.globalData.navBarBottom = this.globalData.navBarHeight + systemInfo.statusBarHeight;
    },
    //使用方法： getApp().globalData.text = 'test'
    globalData: {
      userInfo: {},
      statusBarHeight: 0, //状态栏高度
      windowHeight: 0, //窗口高度
      menuWidth: 0, //胶囊按钮 宽度
      menuHeight: 0, //胶囊按钮 高度
      menuLeft: 0, //胶囊按钮 距离屏幕左边的距离
      menuRight: 0, //胶囊按钮 距离屏幕右边的距离
      menuBottom: 0, //胶囊按钮 距离屏幕右边的距离
      navBarHeight: 0, // 导航栏高度
      navBarBottom: 0 //胶囊按钮底部位置
    }
    // onShow: function() {
    // 	console.log('this.globalData.uToastRef show', this.$refs );
    // },
    // onHide: function() {
    // 	console.log('App Hide')
    // }
  };
</script>

<style lang="scss">
  @import '@/uni_modules/uview-plus/index.scss';
  
  page {
	color: $uni-text-color;
  	background-color: #f7f7f7 !important;
  	-webkit-tap-highlight-color: rgba(255, 255, 255, 0); /* 解决点击时偶尔会出现的蓝色背景 */
  }
</style>
